<!DOCTYPE HTML>
<html lang="zxx">

<head>
	<title>注册</title>
	<!-- Meta-Tags -->
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta charset="utf-8">
	<meta name="keywords" content="">
	<script>
		addEventListener("load", function () {
			setTimeout(hideURLbar, 0);
		}, false);

		function hideURLbar() {
			window.scrollTo(0, 1);
		}
	</script>
	<!-- //Meta-Tags -->
	<!-- Stylesheets -->
	<link href="style.css" tppabs="https://demo.mycodes.net/denglu/jiaoyu_login/css/style.css" rel='stylesheet' type='text/css' />
</head>

<body>
	<h1>少儿编程教育注册系统</h1>
	<div class="w3ls-login box">
		<img src="logo.png" tppabs="https://demo.mycodes.net/denglu/jiaoyu_login/images/logo.png" alt="logo_img" />
		<!-- form starts here -->
		<form action="#" method="post">
			<div class="agile-field-txt">
				<input type="email" name="email" placeholder="请输入你的用户名" required="" />
			</div>
			<div class="agile-field-txt">
				<input type="email" name="email" placeholder="请输入你的手机号" required="" />
			</div>
			<div class="agile-field-txt">
				<input type="email" name="email" placeholder="请输入你的地址" required="" />
			</div>
			<div class="agile-field-txt">
				<input type="email" name="email" placeholder="请输入你的密码" required="" />
			</div>
			<div class="w3ls-bot">
				<input type="submit" value="注册">
			</div>
		</form>
	</div>
</body>

<script>
  
   function add(){
     
     
     var username = $("#username").val()
    var password = $("#password").val()
    var loginname = $("#loginname").val()
    
    if (username == null || username == ""){
       alert("请输入用户名")  
       reutrn 
    }
    if (password == null || password == ""){
       alert("请输入密码")  
       return 
    }
    if (loginname == null || loginname == ""){
       alert("请输入昵称")  
       return 
    }
    
    $.ajax({
      type:"get",
      url:"http://localhost:8080/add",
      data:{username:username,
        password:password,
        loginname:loginname
      },
      success:function(result){
        console.log(result)
        if (result == "1"){
          alert("恭喜注册成功")
          window.location = "login.html"
        }else{
          alert("注册失败")
        }
      }
      
    });    
   }
</script>


<script src="jquery-1.11.1.min.js"></script>

</html>